package com.learn.aop.controller;

import com.learn.aop.dto.TestDomain;
import com.learn.aop.service.impl.LogServiceImpl;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
public class TestController {

    @Resource
    private LogServiceImpl testService;

    @GetMapping("/test")
    public String test(@RequestParam("p1") String p1) {
        TestDomain testDomain = new TestDomain();
        testDomain.setId(1);
        testDomain.setTitle("t1");
        testService.log1(p1,testDomain);
        testService.log2(p1,testDomain);
//        testService.throwException();
        return "hello aop";
    }

}
